package com.ruoyi.business.component.mqconsumer.repaymentconsumers;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bizsys.domain.CreditAccount;
import com.ruoyi.bizsys.domain.LoanIou;
import com.ruoyi.bizsys.domain.ProductDeferredInfo;
import com.ruoyi.bizsys.domain.RepaymentOrder;
import com.ruoyi.bizsys.utils.BizConstants;
import com.ruoyi.business.service.IRepaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * Self Repayment--非延期-钱包部分还款的
 * @author wqg
 * @description
 * @date 2022/5/21
 */
@Slf4j
@Service(BizConstants.ROCKMQ_REPAYMENT_TYPE_SELF_REPAYMENT_ALL_WALLET_NOT_ALL)
public class SelfWalletNotAllRepaymentConsumer implements IRepaymentMqService{

    @Autowired
    IRepaymentService iRepaymentService;
    /**
     * @param msgObj
     */
    @Override
    public void handle(JSONObject msgObj) {
        log.info("Self 非延期全额还款 wallet no all Repayment-start：data:{}", msgObj.toString());
        RepaymentOrder repaymentOrder = msgObj.getObject("repaymentOrder",RepaymentOrder.class);
        long creditAccountId = msgObj.getLong("creditAccountId");
        iRepaymentService.selfNotAllRepaymentForMqListener(repaymentOrder,creditAccountId);
        log.info("Self 非延期全额还款 wallet no all Repayment-end：data:{}",msgObj);

    }
}
